package com.unipay.oss.controller;

import com.unipay.common.result.Result;
import com.unipay.oss.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Project: yitong_parent
 * @Author: C.yu
 * @Time: 2023-05-15 22:09:07
 * @Desc: TODO
 */
@RestController
@RequestMapping("/api/oss")
public class FileController {
    @Autowired
    private FileService fileService;

    // 上传文件到阿里云oss
    @PostMapping("fileUpload")
    public Result fileUpload(MultipartFile file){
        String fileUrl = fileService.fileUpload(file);
        System.out.println("fileUrl: " + fileUrl);
        return Result.ok(fileUrl);
    }
}
